package com.yange.accountbook.ui

import android.content.Context
import android.content.Intent
import androidx.fragment.app.Fragment
import com.yange.accountbook.databinding.DetailedManageLayoutBinding
import com.yange.accountbook.ui.adapter.BaseFragmentPagerAdapter

class DetailedManageActivity:BaseActivity<DetailedManageLayoutBinding>() {


    private var titleList = mutableListOf("支出", "收入")
    var pagerAdapter: BaseFragmentPagerAdapter? = null

    override fun getViewBinding() = DetailedManageLayoutBinding.inflate(layoutInflater)

    override fun init() {
        val fragmentList = mutableListOf<Fragment>()
        fragmentList.add(DetailedManageFragment.newInstance(AddItemInFragment().TYPE_OUT))
        fragmentList.add(DetailedManageFragment.newInstance(AddItemInFragment().TYPE_IN))
        pagerAdapter = BaseFragmentPagerAdapter(fragmentList, titleList, supportFragmentManager)
        binding.viewpager.adapter = pagerAdapter
        binding.ivBack.setOnClickListener {
            finish()
        }
        binding.tabLayout.setupWithViewPager(binding.viewpager)
    }
    companion object{
        fun start(context: Context){
            var intent = Intent(context,DetailedManageActivity().javaClass)
            context.startActivity(intent)
        }
    }
}